import { createStore } from 'vuex'
import getters from './getters'
import category from './modules/category'
import theme from './modules/theme'
import createPersistState from 'vuex-persistedstate'

const store = createStore({
    getters,
    modules: { category, theme },
    plugins: [
        createPersistState({
            //key 指定保存到localStoreage中的key 值
            key: 'imooc-front',
            //需要保存的模块 只有放在paths中的模块才会被缓存
            paths: ['category', 'theme']
        })
    ]
})

export default store
